home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 December / MACPOWER-1997-12.ISO.7z / MACPOWER-1997-12.ISO / AMUG / PROGRAMMING / Raven 1.2 Examples.sit / Raven 1.2 Examples / Quill / Source / Application.cpp < prev    next >
Text File  |  1997-08-26  |  4KB  |  168 lines

  1. /*
  2.  *  File:       Application.cpp
  3.  *  Summary:       Application object.
  4.  *  Written by: Jesse Jones
  5.  *
  6.  *  Copyright ゥ 1996-1997 Jesse Jones. 
  7.  *    For conditions of distribution and use, see copyright notice in ZTypes.h  
  8.  *
  9.  *  Change History (most recent first):    
  10.  *
  11.  *         <2>     4/06/97    JDJ        No longer overrides DoWindowMouseDown and co.
  12.  *         <1>     8/09/96    JDJ        Created
  13.  */
  14.  
  15. #include "Application.h"
  16.  
  17. #include <ZDialogUtils.h>
  18. #include <ZProcess.h>
  19. #include <ZWindowMenuMgr.h>
  20.  
  21. #include "Document.h"
  22. #include "DocWindow.h"
  23.  
  24. #include "ViewContainer.h"
  25.  
  26.  
  27. //-----------------------------------
  28. //    Constants
  29. //
  30. const MenuCommand kPrefsCmd = "Preferences";
  31.  
  32.  
  33. // ===================================================================================
  34. //    class CApplication
  35. // ===================================================================================
  36.  
  37. //---------------------------------------------------------------
  38. //
  39. // CApplication::~CApplication
  40. //
  41. //---------------------------------------------------------------
  42. CApplication::~CApplication()
  43. {
  44.     PRECONDITION(true);
  45. }
  46.  
  47.  
  48. //---------------------------------------------------------------
  49. //
  50. // CApplication::CApplication
  51. //
  52. //---------------------------------------------------------------
  53. CApplication::CApplication()
  54. {
  55.     mNumFileTypes = 1;
  56.     mFileTypes[0] = 'RVob';
  57.     
  58. //    POSTCONDITION(true);            // wait till HandleInit is called (by Run)            
  59. }
  60.  
  61. #pragma mark ハ
  62.  
  63. //---------------------------------------------------------------
  64. //
  65. // CApplication::OnInit
  66. //
  67. //---------------------------------------------------------------
  68. void CApplication::OnInit()
  69. {
  70.     Inherited::OnInit();
  71.  
  72.     TWindowMenuMgr::Init();
  73.     
  74.     (void) TWindow::Create(204, this);        // pane list box
  75. }
  76.  
  77.  
  78. //---------------------------------------------------------------
  79. //
  80. // CApplication::OnQuit
  81. //
  82. //---------------------------------------------------------------
  83. void CApplication::OnQuit()
  84. {
  85.     TWindowMenuMgr::Terminate();
  86.     
  87.     Inherited::OnQuit();
  88. }
  89.  
  90.  
  91. //---------------------------------------------------------------
  92. //
  93. // CApplication::OnAboutBox
  94. //
  95. //---------------------------------------------------------------
  96. void CApplication::OnAboutBox()
  97. {
  98.     (void) DoAlert(256);
  99. }
  100.  
  101.  
  102. //---------------------------------------------------------------
  103. //
  104. // CApplication::OnCreateDoc
  105. //
  106. //---------------------------------------------------------------
  107. TDocument* CApplication::OnCreateDoc()
  108. {
  109.     CDocument* doc = new CDocument(this);
  110.  
  111.     (void) TWindow::Create(201, doc);
  112.     
  113.     return doc;
  114. }
  115.  
  116.  
  117. //---------------------------------------------------------------
  118. //
  119. // CApplication::OnOpenWithoutDoc
  120. //
  121. //---------------------------------------------------------------
  122. void CApplication::OnOpenWithoutDoc()
  123. {
  124. #if DEBUG
  125.     if (UProcess::InFront())            // if debugger is in foreground standard file misbehaves
  126. #endif
  127.         this->HandleOpen();
  128. }
  129.  
  130.  
  131. //---------------------------------------------------------------
  132. //
  133. // CApplication::OnMenuCommand
  134. //
  135. //---------------------------------------------------------------
  136. bool CApplication::OnMenuCommand(const MenuCommand& command)
  137. {
  138.     bool handled = true;
  139.     
  140.     if (command == kPrefsCmd) {
  141.             
  142.     } else if (mQuitting || !TWindowMenuMgr::Instance()->HandleMenuCommand(command))
  143.         handled = Inherited::OnMenuCommand(command);
  144.     
  145.     return handled;
  146. }
  147.  
  148.     
  149. //---------------------------------------------------------------
  150. //
  151. // CApplication::OnCommandStatus
  152. //
  153. //---------------------------------------------------------------
  154. bool CApplication::OnCommandStatus(const MenuCommand& command, SCommandStatus& status)
  155. {
  156.     bool handled = true;
  157.     
  158.     if (command == kPrefsCmd) {
  159.         status.enabled = false;
  160.             
  161.     } else if (mQuitting || !TWindowMenuMgr::Instance()->HandleCommandStatus(command, status))
  162.         handled = Inherited::OnCommandStatus(command, status);
  163.     
  164.     return handled;
  165. }
  166.  
  167.  
  168.